package com.study.jvm.classloader;

public class InitTest1 {
    public static void main(String[] args) {
        //先加载类
        //链接 （准备阶段 类初始化 调用 cinit）
        //初始化 (对象初始化 调用init())
        SingleTon singleTon = SingleTon.getInstance();
        System.out.println("count1=" + singleTon.count1);
        System.out.println("count2=" + singleTon.count2);
    }
}

class SingleTon {
    private static SingleTon singleTon = new SingleTon();
    public static int count1;
    public static int count2 = 0;

    private SingleTon() {
        count1++;
        count2++;
    }

    public static SingleTon getInstance() {
        return singleTon;
    }
}

